<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>用户登录</title>
		<!-- 样 式 文 件 -->
		<link type="text/css" rel="stylesheet" href="${ctx.contextPath}/static/plugins/pear/css/pear.css" />
		<link type="text/css" rel="stylesheet" href="${ctx.contextPath}/static/plugins/admin/css/other/login.css" />
		<style>
			.desc{
				height: 0!important;
				line-height: 0!important;
			}
		</style>
	</head>
    <!-- 代 码 结 构 -->
	<body background="${ctx.contextPath}/static/plugins/admin/images/background2.svg" style="background-size: cover;">
		<form class="layui-form" action="javascript:void(0);">
			<div class="layui-form-item">
				<img class="logo" src="${ctx.contextPath}/static/plugins/admin/images/logo.png" />
				<div class="title">Admin</div>
				<div class="desc">
				</div>
			</div>
			<div class="layui-form-item">
				<input placeholder="账 户  " type="text" name="username" class="layui-input"  />
			</div>
			<div class="layui-form-item">
				<input placeholder="密 码  " type="password" name="password" class="layui-input"  />
			</div>
			<div class="layui-form-item">
				<input placeholder="验证码 " type="text" name="code" class="code layui-input layui-input-inline"  />
				<img src="${ctx.contextPath}/static/plugins/admin/images/captcha.gif" class="codeImage" />
			</div>
			<div class="layui-form-item">
				<input type="checkbox" name="remenber" title="记住密码" lay-skin="primary" checked>
			</div>
			<div class="layui-form-item">
				<button type="button" class="pear-btn pear-btn-success login" lay-submit lay-filter="login">
					登 入
				</button>
			</div>
		</form>
		<!-- 资 源 引 入 -->
		<script type="text/javascript">window.g = {ctx: '${ctx.contextPath}'};</script>
		<script type="text/javascript" src="${ctx.contextPath}/static/js/common/tool.js"></script>
		<script type="text/javascript" src="${ctx.contextPath}/static/plugins/layui/layui.js"></script>
		<script stype="text/javascript" rc="${ctx.contextPath}/static/plugins/pear/pear.js"></script>
		<script type="text/javascript">
			if(window.top !== window.self){
				//判断是否有父页面
				setTimeout(function(){
					parent.location.reload();
				},200);
			}

			layui.use(['form', 'jquery'], function() {
				var form = layui.form;
				var $ = layui.jquery;

                // 登 录 提 交
				form.on('submit(login)', function(data) {
					ajax({
						url: g.ctx + "/login",
						type: "post",
						data: {
							"username": $('input[name="username"]').val(),
							"password": $('input[name="password"]').val()
						},
						success: function (resp) {
							console.log(resp.data);
							layer.msg('登录成功', {icon: 1}, function () {
								window.location.href = g.ctx + '/index';
							})

						}
					});
					return false;
				});
			})
		</script>
	</body>
</html>
